namespace DotNetNuke.UI.UserControls
{
    using DotNetNuke.Common;
    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Entities.Portals;
    using DotNetNuke.Entities.Users;
    using DotNetNuke.Framework;
    using DotNetNuke.Security;
    using DotNetNuke.Services.Exceptions;
    using DotNetNuke.Services.FileSystem;
    using DotNetNuke.Services.Localization;
    using DotNetNuke.UI.Utilities;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Runtime.CompilerServices;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class UrlControl : UserControlBase
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        //("cboFiles")]
        private DropDownList _cboFiles;
        //("cboFolders")]
        private DropDownList _cboFolders;
        //("cboTabs")]
        private DropDownList _cboTabs;
        //("cboUrls")]
        private DropDownList _cboUrls;
        //("chkLog")]
        private CheckBox _chkLog;
        //("chkNewWindow")]
        private CheckBox _chkNewWindow;
        //("chkTrack")]
        private CheckBox _chkTrack;
        //("cmdAdd")]
        private LinkButton _cmdAdd;
        //("cmdCancel")]
        private LinkButton _cmdCancel;
        //("cmdDelete")]
        private LinkButton _cmdDelete;
        //("cmdSave")]
        private LinkButton _cmdSave;
        //("cmdSelect")]
        private LinkButton _cmdSelect;
        //("cmdUpload")]
        private LinkButton _cmdUpload;
        //("ErrorRow")]
        private HtmlTableRow _ErrorRow;
        //("FileRow")]
        private HtmlTableRow _FileRow;
        //("lblFile")]
        private Label _lblFile;
        //("lblFolder")]
        private Label _lblFolder;
        //("lblMessage")]
        private Label _lblMessage;
        //("lblTab")]
        private Label _lblTab;
        //("lblURL")]
        private Label _lblURL;
        //("lblURLType")]
        private Label _lblURLType;
        private string _localResourceFile;
        private int _ModuleID;
        private PortalInfo _objPortal;
        //("optType")]
        private RadioButtonList _optType;
        private bool _Required;
        private bool _ShowFiles;
        private bool _ShowLog;
        private bool _ShowNewWindow;
        private bool _ShowNone;
        private bool _ShowTabs;
        private bool _ShowTrack;
        private bool _ShowUpLoad;
        private bool _ShowUrls;
        //("TabRow")]
        private HtmlTableRow _TabRow;
        //("txtFile")]
        private HtmlInputFile _txtFile;
        //("txtUrl")]
        private TextBox _txtUrl;
        //("TypeRow")]
        private HtmlTableRow _TypeRow;
        private string _Url;
        //("URLRow")]
        private HtmlTableRow _URLRow;
        private string _UrlType;
        private string _Width;

        public UrlControl()
        {
            base.Load += new EventHandler(this.Page_Load);
            base.Init += new EventHandler(this.Page_Init);
            List<WeakReference> refObjectHelperL0 = __ENCList;
            lock (refObjectHelperL0)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this._ModuleID = -2;
            this._Width = "";
            this._ShowNone = false;
            this._ShowUrls = true;
            this._ShowTabs = true;
            this._ShowUpLoad = true;
            this._ShowFiles = true;
            this._ShowNewWindow = false;
            this._ShowLog = true;
            this._ShowTrack = true;
            this._Required = true;
            this._Url = "";
            this._UrlType = "";
        }

        private void cboFolders_SelectedIndexChanged(object sender, EventArgs e)
        {
            string path;
            if (this.cboFolders.SelectedValue != "")
            {
                path = this.cboFolders.SelectedValue.Substring(0, this.cboFolders.SelectedValue.Length - 1);
            }
            else
            {
                path = this.cboFolders.SelectedValue;
            }
            if (PortalSecurity.IsInRoles(this.GetWriteRoles(path)))
            {
                if (!this.txtFile.Visible)
                {
                    this.cmdUpload.Visible = this._ShowUpLoad;
                }
            }
            else
            {
                this.cboFiles.Visible = true;
                this.cmdUpload.Visible = false;
                this.txtFile.Visible = false;
                this.cmdSave.Visible = false;
                this.cmdCancel.Visible = false;
            }
            this.cboFiles.Items.Clear();
            this.cboFiles.DataSource = this.GetFileList(this.FileFilter, false, this.cboFolders.SelectedItem.Value);
            this.cboFiles.DataBind();
        }

        private void cmdAdd_Click(object sender, EventArgs e)
        {
            this.cboUrls.Visible = false;
            this.cmdSelect.Visible = true;
            this.txtUrl.Visible = true;
            this.cmdAdd.Visible = false;
            this.cmdDelete.Visible = false;
        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.cboFiles.Visible = true;
            this.cmdUpload.Visible = true;
            this.txtFile.Visible = false;
            this.cmdSave.Visible = false;
            this.cmdCancel.Visible = false;
        }

        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (this.cboUrls.SelectedItem != null)
            {
                new UrlController().DeleteUrl(this._objPortal.PortalID, this.cboUrls.SelectedItem.Value);
                this.ShowControls();
            }
        }

        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (this.txtFile.PostedFile.FileName != "")
            {
                string ParentFolderName;
                if (this.PortalSettings.ActiveTab.ParentId == this.PortalSettings.SuperTabId)
                {
                    ParentFolderName = DotNetNuke.Common.Globals.HostMapPath;
                }
                else
                {
                    ParentFolderName = this.PortalSettings.HomeDirectoryMapPath;
                }
                ParentFolderName = ParentFolderName + this.cboFolders.SelectedItem.Value;
                string strExtension = Strings.Replace(Path.GetExtension(this.txtFile.PostedFile.FileName), ".", "", 1, -1, CompareMethod.Binary);
                if ((this.FileFilter != "") & (Strings.InStr("," + this.FileFilter.ToLower(), "," + strExtension.ToLower(), CompareMethod.Binary) == 0))
                {
                    this.lblMessage.Text = string.Format(DotNetNuke.Services.Localization.Localization.GetString("UploadError", this.LocalResourceFile), this.FileFilter, strExtension);
                }
                else
                {
                    this.lblMessage.Text = DotNetNuke.Common.Globals.UploadFile(ParentFolderName.Replace("/", @"\"), this.txtFile.PostedFile, false);
                }
                if (this.lblMessage.Text == string.Empty)
                {
                    this.cboFiles.Visible = true;
                    this.cmdUpload.Visible = this._ShowUpLoad;
                    this.txtFile.Visible = false;
                    this.cmdSave.Visible = false;
                    this.cmdCancel.Visible = false;
                    DirectoryInfo Root = new DirectoryInfo(ParentFolderName);
                    this.cboFiles.Items.Clear();
                    this.cboFiles.DataSource = this.GetFileList(this.FileFilter, false, this.cboFolders.SelectedItem.Value);
                    this.cboFiles.DataBind();
                    string FileName = this.txtFile.PostedFile.FileName.Substring(this.txtFile.PostedFile.FileName.LastIndexOf(@"\") + 1);
                    if (this.cboFiles.Items.FindByText(FileName) != null)
                    {
                        this.cboFiles.Items.FindByText(FileName).Selected = true;
                    }
                }
            }
        }

        private void cmdSelect_Click(object sender, EventArgs e)
        {
            this.cboUrls.Visible = true;
            this.cmdSelect.Visible = false;
            this.txtUrl.Visible = false;
            this.cmdAdd.Visible = true;
            this.cmdDelete.Visible = PortalSecurity.IsInRole(this._objPortal.AdministratorRoleName);
        }

        private void cmdUpload_Click(object sender, EventArgs e)
        {
            this.cboFiles.Visible = false;
            this.cmdUpload.Visible = false;
            this.txtFile.Visible = true;
            this.cmdSave.Visible = true;
            this.cmdCancel.Visible = true;
        }

        private ArrayList GetFileList(string strExtensions, bool NoneSpecified, string Folder)
        {
            if (this.PortalSettings.ActiveTab.ParentId == this.PortalSettings.SuperTabId)
            {
                return DotNetNuke.Common.Globals.GetFileList(Null.NullInteger, this.FileFilter, NoneSpecified, this.cboFolders.SelectedItem.Value);
            }
            return DotNetNuke.Common.Globals.GetFileList(this._objPortal.PortalID, this.FileFilter, NoneSpecified, this.cboFolders.SelectedItem.Value);
        }

        private string GetReadRoles(string Folder)
        {
            return FileSystemUtils.GetRoles(Folder, this._objPortal.PortalID, "READ");
        }

        private string GetWriteRoles(string Folder)
        {
            return FileSystemUtils.GetRoles(Folder, this._objPortal.PortalID, "WRITE");
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
        }

        private void LoadFolders(DirectoryInfo ChildDir)
        {
            string ParentFolderName;
            if (this.PortalSettings.ActiveTab.ParentId == this.PortalSettings.SuperTabId)
            {
                ParentFolderName = ChildDir.FullName.Substring(DotNetNuke.Common.Globals.HostMapPath.Length);
            }
            else
            {
                ParentFolderName = ChildDir.FullName.Substring(this._objPortal.HomeDirectoryMapPath.Length);
            }
            DirectoryInfo CurrentDir = ChildDir;
            foreach (DirectoryInfo ChildDirirectory in CurrentDir.GetDirectories())
            {
                ListItem FolderItem = new ListItem();
                string ItemText = ParentFolderName.Replace(@"\", "/") + "/" + ChildDirirectory.Name;
                if (ItemText.StartsWith("/"))
                {
                    ItemText = ItemText.Remove(0, 1);
                }
                if (ItemText.EndsWith("/"))
                {
                    ItemText = ItemText.Remove(ItemText.Length - 1, 1);
                }
                string strReadRoles = this.GetReadRoles(ItemText);
                string strWriteRoles = this.GetWriteRoles(ItemText);
                if (PortalSecurity.IsInRoles(strReadRoles) | PortalSecurity.IsInRoles(strWriteRoles))
                {
                    FolderItem.Text = ItemText;
                    FolderItem.Value = ItemText + "/";
                    this.cboFolders.Items.Add(FolderItem);
                }
                if (ChildDirirectory.GetDirectories().Length > 0)
                {
                    this.LoadFolders(ChildDirirectory);
                }
            }
        }

        private void optType_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.ShowControls();
        }

        private void Page_Init(object sender, EventArgs e)
        {
            this.InitializeComponent();
        }

        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                PortalController objPortals = new PortalController();
                if ((this.Request.QueryString["pid"] != null) & ((this.PortalSettings.ActiveTab.ParentId == this.PortalSettings.SuperTabId) | UserController.GetCurrentUserInfo().IsSuperUser))
                {
                    this._objPortal = objPortals.GetPortal(int.Parse(this.Request.QueryString["pid"]));
                }
                else
                {
                    this._objPortal = objPortals.GetPortal(this.PortalSettings.PortalId);
                }
                if (!this.Page.IsPostBack)
                {
                    ClientAPI.AddButtonConfirm(this.cmdDelete, DotNetNuke.Services.Localization.Localization.GetString("DeleteItem"));
                    if (this._Width != "")
                    {
                        this.cboUrls.Width = Unit.Parse(this._Width);
                        this.txtUrl.Width = Unit.Parse(this._Width);
                        this.cboTabs.Width = Unit.Parse(this._Width);
                        this.cboFolders.Width = Unit.Parse(this._Width);
                        this.cboFiles.Width = Unit.Parse(this._Width);
                    }
                    if (this._ShowNone)
                    {
                        this.optType.Items.Add(new ListItem(DotNetNuke.Services.Localization.Localization.GetString("NoneType", this.LocalResourceFile), "N"));
                    }
                    if (this._ShowUrls)
                    {
                        this.optType.Items.Add(new ListItem(DotNetNuke.Services.Localization.Localization.GetString("URLType", this.LocalResourceFile), "U"));
                    }
                    if (this._ShowTabs)
                    {
                        this.optType.Items.Add(new ListItem(DotNetNuke.Services.Localization.Localization.GetString("TabType", this.LocalResourceFile), "T"));
                    }
                    if (this._ShowFiles)
                    {
                        this.optType.Items.Add(new ListItem(DotNetNuke.Services.Localization.Localization.GetString("FileType", this.LocalResourceFile), "F"));
                    }
                    this.chkNewWindow.Visible = this._ShowNewWindow;
                    this.chkLog.Visible = this._ShowLog;
                    this.chkTrack.Visible = this._ShowTrack;
                    int URLType = (_ShowTabs?1:0) + (_ShowFiles?1:0) + (_ShowUrls?1:0);
                    if (URLType == -1)
                    {
                        this.TypeRow.Visible = false;
                    }
                    this.ViewState["ModuleId"] = Convert.ToString(this._ModuleID);
                    this.ViewState["SkinControlWidth"] = this._Width;
                    this.ShowControls();
                }
            }
            catch (Exception exception1)
            {
                
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
                
            }
        }

        private void ShowControls()
        {
            UrlController objUrls = new UrlController();
            if (this.optType.SelectedItem == null)
            {
                if (this._Url != "")
                {
                    string TrackingUrl = this._Url;
                    this._UrlType = DotNetNuke.Common.Globals.GetURLType(this._Url).ToString("g").Substring(0, 1);
                    if (this._UrlType == "F")
                    {
                        FileController objFiles = new FileController();
                        TrackingUrl = "FileID=" + objFiles.ConvertFilePathToFileId(this._Url, this._objPortal.PortalID).ToString();
                    }
                    UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(this._objPortal.PortalID, TrackingUrl, this.ModuleID);
                    if (objUrlTracking != null)
                    {
                        this.optType.Items.FindByValue(objUrlTracking.UrlType).Selected = true;
                        this.chkNewWindow.Checked = objUrlTracking.NewWindow;
                        this.chkTrack.Checked = objUrlTracking.TrackClicks;
                        this.chkLog.Checked = objUrlTracking.LogActivity;
                    }
                    else
                    {
                        this.optType.Items.FindByValue(this._UrlType).Selected = true;
                        this.chkNewWindow.Checked = false;
                        this.chkTrack.Checked = true;
                        this.chkLog.Checked = false;
                    }
                }
                else
                {
                    if (this._UrlType != "")
                    {
                        if (this.optType.Items.FindByValue(this._UrlType) != null)
                        {
                            this.optType.Items.FindByValue(this._UrlType).Selected = true;
                        }
                        else
                        {
                            this.optType.Items[0].Selected = true;
                        }
                    }
                    else
                    {
                        this.optType.Items[0].Selected = true;
                    }
                    this.chkNewWindow.Checked = false;
                    this.chkTrack.Checked = true;
                    this.chkLog.Checked = false;
                }
            }
            string refStringHelperL0 = this.optType.SelectedItem.Value;
            switch (refStringHelperL0)
            {
                case "N":
                    this.URLRow.Visible = false;
                    this.TabRow.Visible = false;
                    this.FileRow.Visible = false;
                    break;

                case "U":
                    this.URLRow.Visible = true;
                    this.TabRow.Visible = false;
                    this.FileRow.Visible = false;
                    if (this.txtUrl.Text == "")
                    {
                        this.txtUrl.Text = this._Url;
                    }
                    if (this.txtUrl.Text == "")
                    {
                        this.txtUrl.Text = "http://";
                    }
                    this.txtUrl.Visible = true;
                    this.cmdSelect.Visible = true;
                    this.cboUrls.Items.Clear();
                    this.cboUrls.DataSource = objUrls.GetUrls(this._objPortal.PortalID);
                    this.cboUrls.DataBind();
                    if (this.cboUrls.Items.FindByValue(this._Url) != null)
                    {
                        this.cboUrls.Items.FindByValue(this._Url).Selected = true;
                    }
                    this.cboUrls.Visible = false;
                    this.cmdAdd.Visible = false;
                    this.cmdDelete.Visible = false;
                    break;

                case "T":
                    this.URLRow.Visible = false;
                    this.TabRow.Visible = true;
                    this.FileRow.Visible = false;
                    this.cboTabs.Items.Clear();
                    this.cboTabs.DataSource = DotNetNuke.Common.Globals.GetPortalTabs(this._objPortal.PortalID, !this._Required, true, false, false, false);
                    this.cboTabs.DataBind();
                    if (this.cboTabs.Items.FindByValue(this._Url) != null)
                    {
                        this.cboTabs.Items.FindByValue(this._Url).Selected = true;
                    }
                    break;

                default:
                    if (refStringHelperL0 == "F")
                    {
                        string ParentFolderName;
                        this.URLRow.Visible = false;
                        this.TabRow.Visible = false;
                        this.FileRow.Visible = true;
                        this.cboFolders.Items.Clear();
                        ListItem FolderItem = new ListItem();
                        FolderItem.Text = "Root";
                        FolderItem.Value = string.Empty;
                        string ReadRoles = this.GetReadRoles("");
                        string WriteRoles = this.GetWriteRoles("");
                        if (PortalSecurity.IsInRoles(ReadRoles) | PortalSecurity.IsInRoles(WriteRoles))
                        {
                            this.cboFolders.Items.Add(FolderItem);
                        }
                        if (this.PortalSettings.ActiveTab.ParentId == this.PortalSettings.SuperTabId)
                        {
                            ParentFolderName = DotNetNuke.Common.Globals.HostMapPath;
                        }
                        else
                        {
                            ParentFolderName = this._objPortal.HomeDirectoryMapPath;
                        }
                        DirectoryInfo Root = new DirectoryInfo(ParentFolderName);
                        this.LoadFolders(Root);
                        if (this.cboFolders.Items.Count == 0)
                        {
                            this.lblMessage.Text = DotNetNuke.Services.Localization.Localization.GetString("NoPermission", this.LocalResourceFile);
                            this.FileRow.Visible = false;
                        }
                        else
                        {
                            string FileName;
                            string FolderPath;
                            if (this._Url != string.Empty)
                            {
                                FileName = this._Url.Substring(this._Url.LastIndexOf("/") + 1);
                                FolderPath = this._Url.Replace(FileName, "");
                            }
                            else
                            {
                                FileName = this._Url;
                                FolderPath = string.Empty;
                            }
                            if (this.cboFolders.Items.FindByValue(FolderPath) != null)
                            {
                                this.cboFolders.Items.FindByValue(FolderPath).Selected = true;
                            }
                            else
                            {
                                this.cboFolders.Items[0].Selected = true;
                                FolderPath = this.cboFolders.SelectedValue;
                            }
                            this.cboFiles.DataSource = this.GetFileList(this.FileFilter, !this._Required, this.cboFolders.SelectedItem.Value);
                            this.cboFiles.DataBind();
                            if (this.cboFiles.Items.FindByText(FileName) != null)
                            {
                                this.cboFiles.Items.FindByText(FileName).Selected = true;
                            }
                            this.cboFiles.Visible = true;
                            this.txtFile.Visible = false;
                            if (FolderPath != "")
                            {
                                FolderPath = FolderPath.Substring(0, FolderPath.Length - 1);
                            }
                            string strWriteRoles = this.GetWriteRoles(FolderPath);
                            this.cmdUpload.Visible = PortalSecurity.IsInRoles(strWriteRoles) & this._ShowUpLoad;
                            this.txtUrl.Visible = false;
                            this.cmdSave.Visible = false;
                            this.cmdCancel.Visible = false;
                        }
                    }
                    break;
            }
        }

        protected virtual DropDownList cboFiles
        {
           
            get
            {
                return this._cboFiles;
            }
            
            set
            {
                this._cboFiles = value;
            }
        }

        protected virtual DropDownList cboFolders
        {
           
            get
            {
                return this._cboFolders;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cboFolders_SelectedIndexChanged);
                if (this._cboFolders != null)
                {
                    this._cboFolders.SelectedIndexChanged -= handler;
                }
                this._cboFolders = value;
                if (this._cboFolders != null)
                {
                    this._cboFolders.SelectedIndexChanged += handler;
                }
            }
        }

        protected virtual DropDownList cboTabs
        {
           
            get
            {
                return this._cboTabs;
            }
            
            set
            {
                this._cboTabs = value;
            }
        }

        protected virtual DropDownList cboUrls
        {
           
            get
            {
                return this._cboUrls;
            }
            
            set
            {
                this._cboUrls = value;
            }
        }

        protected virtual CheckBox chkLog
        {
           
            get
            {
                return this._chkLog;
            }
            
            set
            {
                this._chkLog = value;
            }
        }

        protected virtual CheckBox chkNewWindow
        {
           
            get
            {
                return this._chkNewWindow;
            }
            
            set
            {
                this._chkNewWindow = value;
            }
        }

        protected virtual CheckBox chkTrack
        {
           
            get
            {
                return this._chkTrack;
            }
            
            set
            {
                this._chkTrack = value;
            }
        }

        protected virtual LinkButton cmdAdd
        {
           
            get
            {
                return this._cmdAdd;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cmdAdd_Click);
                if (this._cmdAdd != null)
                {
                    this._cmdAdd.Click -= handler;
                }
                this._cmdAdd = value;
                if (this._cmdAdd != null)
                {
                    this._cmdAdd.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdCancel
        {
           
            get
            {
                return this._cmdCancel;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cmdCancel_Click);
                if (this._cmdCancel != null)
                {
                    this._cmdCancel.Click -= handler;
                }
                this._cmdCancel = value;
                if (this._cmdCancel != null)
                {
                    this._cmdCancel.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdDelete
        {
           
            get
            {
                return this._cmdDelete;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cmdDelete_Click);
                if (this._cmdDelete != null)
                {
                    this._cmdDelete.Click -= handler;
                }
                this._cmdDelete = value;
                if (this._cmdDelete != null)
                {
                    this._cmdDelete.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdSave
        {
           
            get
            {
                return this._cmdSave;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cmdSave_Click);
                if (this._cmdSave != null)
                {
                    this._cmdSave.Click -= handler;
                }
                this._cmdSave = value;
                if (this._cmdSave != null)
                {
                    this._cmdSave.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdSelect
        {
           
            get
            {
                return this._cmdSelect;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cmdSelect_Click);
                if (this._cmdSelect != null)
                {
                    this._cmdSelect.Click -= handler;
                }
                this._cmdSelect = value;
                if (this._cmdSelect != null)
                {
                    this._cmdSelect.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdUpload
        {
           
            get
            {
                return this._cmdUpload;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.cmdUpload_Click);
                if (this._cmdUpload != null)
                {
                    this._cmdUpload.Click -= handler;
                }
                this._cmdUpload = value;
                if (this._cmdUpload != null)
                {
                    this._cmdUpload.Click += handler;
                }
            }
        }

        protected virtual HtmlTableRow ErrorRow
        {
           
            get
            {
                return this._ErrorRow;
            }
            
            set
            {
                this._ErrorRow = value;
            }
        }

        public string FileFilter
        {
            get
            {
                if (this.ViewState["_FileFilter"] != null)
                {
                    return Conversions.ToString(this.ViewState["_FileFilter"]);
                }
                return "";
            }
            set
            {
                this.ViewState["_FileFilter"] = value;
            }
        }

        protected virtual HtmlTableRow FileRow
        {
           
            get
            {
                return this._FileRow;
            }
            
            set
            {
                this._FileRow = value;
            }
        }

        protected virtual Label lblFile
        {
           
            get
            {
                return this._lblFile;
            }
            
            set
            {
                this._lblFile = value;
            }
        }

        protected virtual Label lblFolder
        {
           
            get
            {
                return this._lblFolder;
            }
            
            set
            {
                this._lblFolder = value;
            }
        }

        protected virtual Label lblMessage
        {
           
            get
            {
                return this._lblMessage;
            }
            
            set
            {
                this._lblMessage = value;
            }
        }

        protected virtual Label lblTab
        {
           
            get
            {
                return this._lblTab;
            }
            
            set
            {
                this._lblTab = value;
            }
        }

        protected virtual Label lblURL
        {
           
            get
            {
                return this._lblURL;
            }
            
            set
            {
                this._lblURL = value;
            }
        }

        protected virtual Label lblURLType
        {
           
            get
            {
                return this._lblURLType;
            }
            
            set
            {
                this._lblURLType = value;
            }
        }

        public string LocalResourceFile
        {
            get
            {
                if (this._localResourceFile == "")
                {
                    return (this.TemplateSourceDirectory + "/App_LocalResources/URLControl.ascx");
                }
                return this._localResourceFile;
            }
            set
            {
                this._localResourceFile = value;
            }
        }

        public bool Log
        {
            get
            {
                return (this.chkLog.Visible && this.chkLog.Checked);
            }
        }

        public int ModuleID
        {
            get
            {
                int ModuleID = Convert.ToInt32(RuntimeHelpers.GetObjectValue(this.ViewState["ModuleId"]));
                if ((ModuleID == -2) && (this.Request.QueryString["mid"] != null))
                {
                    ModuleID = int.Parse(this.Request.QueryString["mid"]);
                }
                return ModuleID;
            }
            set
            {
                this._ModuleID = value;
            }
        }

        public bool NewWindow
        {
            get
            {
                return (this.chkNewWindow.Visible && this.chkNewWindow.Checked);
            }
        }

        protected virtual RadioButtonList optType
        {
           
            get
            {
                return this._optType;
            }
            
            set
            {
                EventHandler handler = new EventHandler(this.optType_SelectedIndexChanged);
                if (this._optType != null)
                {
                    this._optType.SelectedIndexChanged -= handler;
                }
                this._optType = value;
                if (this._optType != null)
                {
                    this._optType.SelectedIndexChanged += handler;
                }
            }
        }

        public bool Required
        {
            set
            {
                this._Required = value;
            }
        }

        public bool ShowFiles
        {
            set
            {
                this._ShowFiles = value;
            }
        }

        public bool ShowLog
        {
            set
            {
                this._ShowLog = value;
            }
        }

        public bool ShowNewWindow
        {
            set
            {
                this._ShowNewWindow = value;
            }
        }

        public bool ShowNone
        {
            set
            {
                this._ShowNone = value;
            }
        }

        public bool ShowTabs
        {
            set
            {
                this._ShowTabs = value;
            }
        }

        public bool ShowTrack
        {
            set
            {
                this._ShowTrack = value;
            }
        }

        public bool ShowUpLoad
        {
            set
            {
                this._ShowUpLoad = value;
            }
        }

        public bool ShowUrls
        {
            set
            {
                this._ShowUrls = value;
            }
        }

        protected virtual HtmlTableRow TabRow
        {
           
            get
            {
                return this._TabRow;
            }
            
            set
            {
                this._TabRow = value;
            }
        }

        public bool Track
        {
            get
            {
                return (this.chkTrack.Visible && this.chkTrack.Checked);
            }
        }

        protected virtual HtmlInputFile txtFile
        {
           
            get
            {
                return this._txtFile;
            }
            
            set
            {
                this._txtFile = value;
            }
        }

        protected virtual TextBox txtUrl
        {
           
            get
            {
                return this._txtUrl;
            }
            
            set
            {
                this._txtUrl = value;
            }
        }

        protected virtual HtmlTableRow TypeRow
        {
           
            get
            {
                return this._TypeRow;
            }
            
            set
            {
                this._TypeRow = value;
            }
        }

        public string Url
        {
            get
            {
                string Url = "";
                string refStringHelperL0 = this.optType.SelectedItem.Value;
                switch (refStringHelperL0)
                {
                    case "U":
                        if (this.cboUrls.Visible)
                        {
                            if (this.cboUrls.SelectedItem != null)
                            {
                                Url = this.cboUrls.SelectedItem.Value;
                            }
                            return Url;
                        }
                        if (this.txtUrl.Text == "http://")
                        {
                            this.txtUrl.Text = "";
                        }
                        return DotNetNuke.Common.Globals.AddHTTP(this.txtUrl.Text);

                    case "T":
                        if (this.cboTabs.SelectedItem != null)
                        {
                            Url = this.cboTabs.SelectedItem.Value;
                        }
                        return Url;
                }
                if (refStringHelperL0 != "F")
                {
                    return Url;
                }
                if (this.cboFiles.SelectedItem == null)
                {
                    return Url;
                }
                if (this.cboFiles.SelectedItem.Value != "")
                {
                    return ("FileID=" + this.cboFiles.SelectedItem.Value);
                }
                return "";
            }
            set
            {
                this._Url = value;
            }
        }

        protected virtual HtmlTableRow URLRow
        {
           
            get
            {
                return this._URLRow;
            }
            
            set
            {
                this._URLRow = value;
            }
        }

        public string UrlType
        {
            get
            {
                return this.optType.SelectedItem.Value;
            }
            set
            {
                this._UrlType = value;
            }
        }

        public string Width
        {
            get
            {
                return Convert.ToString(RuntimeHelpers.GetObjectValue(this.ViewState["SkinControlWidth"]));
            }
            set
            {
                this._Width = value;
            }
        }
    }
}

